package com.cloud.edm.warningEvent.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import com.cloud.edm.warningEvent.domain.Waring;
import com.cloud.edm.warningEvent.repository.WaringRepository;

/**
 * 作用： ① 测试服务实例的相关内容 ② 为后来的服务做提供
 * 
 * @author eacdy
 */
@RestController
public class WaringController {
	@Autowired
	private DiscoveryClient discoveryClient;
	@Autowired
	private WaringRepository waringRepository;

	/**
	 * 注：@GetMapping("/{id}")是spring 4.3的新注解等价于：
	 * 
	 * @RequestMapping(value = "/id", method = RequestMethod.GET)
	 *                       类似的注解还有@PostMapping等等
	 * @param id
	 * @return user信息
	 */
	@GetMapping("/{id}")
	public Waring findById(@PathVariable Long id) {
		// Waring findOne = this.userRepository.findOne(id);
		// return findOne;
		Waring waring = new Waring();
		waring.setId(1L);
		return waring;
	}

}
